package com.example.aijie.autoreadhelper;

import android.app.Application;

import com.example.aijie.autoreadhelper.appbean.BaseAppBean;
import com.example.aijie.autoreadhelper.constant.AppConstant;
import com.example.aijie.autoreadhelper.utils.LogUtils;

import org.litepal.LitePal;

import cn.bmob.v3.Bmob;

public class MyApp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        initDb();
    }

    /**
     * 初始化本地数据库
     */
    private void initDb() {
        LitePal.initialize(this);
        if (AppConstant.appBeanList != null && AppConstant.appBeanList.size() > 0) {
            for (BaseAppBean appBean : AppConstant.appBeanList) {
                appBean.saveOrUpdate("appName = ?", appBean.getAppName());
            }
        }
    }

    /**
     * 初始化云端
     */
    private void initNetDb() {
        //第一：默认初始化
        Bmob.initialize(this, "fb41285e219f9e043330507efedb2808");
    }
}
